package com.shop.service;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.shop.model.Blog;

/**
 * Blog Service
 * 描述：
 */
public class BlogService {

	//private static final Log log = Log.getLog(BlogService.class);
	
	public static final BlogService me = new BlogService();
	private final Blog dao = new Blog().dao();
	
	
	/**
	* 列表-分页
	*/
	public Page<Blog> paginate(int pageNumber, int pageSize) {
		return dao.paginate(pageNumber, pageSize, "SELECT * ", "FROM ");
	}
	
	/**
	* 保存
	*/
	public void save(Blog blog) {
		blog.save();
	}
	
	/**
	* 更新
	*/
	public void update(Blog blog) {
		blog.update();
	}
	
	/**
	* 查询
	*/
	public Blog findById(int blogId) {
		return dao.findFirst("select * from  where id=?", blogId);
	}
	
	/**
	* 删除
	*/
	public void delete(int blogId) {
		Db.update("delete from  where id=?", blogId);
	}
	
	
}